function [sacfile]=NNK_bsac(Strwfs,Strdataless,prefix,hdr);

Strwfs(length(Strwfs):306)=0;

indices = 0:length(Strwfs)-1 ;
time    = (indices/Strdataless{7}) ;
[sacfile] = bsac(time',Strwfs);
%sacfile(1:min([size(sacfile,1) length(hdr)]),3) = hdr(1:min([size(sacfile,1) length(hdr)])) ;

DELTA = 1/Strdataless{7} ;   %
KEVNM = [prefix(1:min([length(prefix) 4]))  datestr(Strdataless{6},'yymmddHHMMSS')] ;
NZYEAR = str2num(datestr(Strdataless{6},'yyyy')) ;
NZJDAY = fix(Strdataless{6})-datenum(NZYEAR,1,1)+1 ;
NZHOUR = str2num(datestr(Strdataless{6},'HH')) ;
NZMIN  = str2num(datestr(Strdataless{6},'MM')) ;
NZSEC  = str2num(datestr(Strdataless{6},'SS')) ;
NZMSEC = str2num(datestr(Strdataless{6},'FFF')) ;
NPTS   = length(Strwfs) ;     %
IZTYPE = 2 ;                  % type of reference time
E    = max(time) ;            %
O    = 0 ;                    %
IDEP = 4 ;                    % =4 pour velocimetre ; =5 pour accelerometre
KNETWK = Strdataless{2} ;     %
KSTNM  = Strdataless{3} ;     %
KCMPNM = Strdataless{4} ;     %

sacfile=ch(sacfile,...
'DELTA',DELTA,...
'KEVNM',KEVNM,...
'NZYEAR',NZYEAR,...
'NZJDAY',NZJDAY,...
'NZHOUR',NZHOUR,...
'NZMIN' ,NZMIN,...
'NZSEC' ,NZSEC,...
'NZMSEC',NZMSEC,...
'NPTS'  ,NPTS,...
'IZTYPE',IZTYPE,...
'E'   ,E,...
'IDEP',IDEP,...
'KNETWK',KNETWK,...
'KSTNM' ,KSTNM,...
'KCMPNM',KCMPNM);
%'O'   ,O,...

